﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>版辊信息选择</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/layui/layui.js"></script>

</head>
<body>
    <div class="layui-fluid" style="width:100%;">
        <ul lay-bar="disabled" class="mWebBanner">
            <li class="layui-nav-item" style="float:left;">
                <button type="button" onclick="Confirm()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#x1005;</i>确定选择
                </button>
            </li>
     
            <li class="layui-nav-item" style="float:left;margin-left:3%">
                <button type="button" onclick="closeWin()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#x1007;</i>关闭页面
                </button>
            </li>
        </ul>
        <div style="float:left;width:100%;">
       
            <div class="layui-card">
            
                <div class="layui-card-body layui-table-body layui-table-main" id="layui-table-main">
                 
                        <span style="margin-left: 2%; padding: 7px; background-color: #FFFFAA;font-size:Xx-small">已被使用</span>

                   
                    <table class="layui-hide" id="list" lay-filter="list"></table>
                </div>
            </div>
        </div>
        <form id="qForm" name="qForm">
            <input type="hidden" name="proCode" id="proCode"/>
            <input type="hidden" name="bomCode" id="bomCode" />
        </form>
    </div>
</body>

</html>

<script>
    var currPage = 1
    var cData = new Array();
    /**
    加载数据
    **/
    function loadData() {
        layui.use('table', function () {
         
            var table = layui.table;
            dUrl = "../Basic/GetDataList?condition=" + JSON.stringify(FormToJson("qForm")) + "&dataType=sbgl";
            table.render({
                elem: '#list'
                , height: 'full-200'   //固定高度-即固定表头固定第一行首行
                , cols: [[ //标题栏
                    { type: 'checkbox' }
                    , { field: 'byBarCode', title: '版辊编码', width: 110 }
                    , { field: 'byCode', title: '版号', width: 100 }
                    , { field: 'banchang', title: '版长', width: 100 }
                    , { field: 'banzhou', title: '版周', width: 100 }
                    , { field: 'supName', title: '供方名称', width: 150 }
                    , { field: 'houseName', title: '入库仓库', width: 120 }
                    , { field: 'relationErpCode', title: 'ERP单号', width: 120 }

                ]], done: function (res, curr, count) {
            
                    $.each(res['data'], function (i, j) {
                        if (j['isUsed'] == "1") {
                            TableRowColor('layui-table-main', i, '#FFFFAA');
                        }

                    });
                }
                , url: dUrl
                , skin: 'row' //表格风格
                , even: true
                , page: true //是否显示分页
                , limits: [15, 30, 50]
                , limit: 15 //每页默认显示的数量

            });

            //监听工具条
            table.on('checkbox(list)', function (obj) {
                var data = obj.data;
                var checkStatus = table.checkStatus('list');
                var select = new Array();
                for (var i = 0; i < checkStatus.data.length; i++) {
                    select.push(checkStatus.data[i]);
                }
                cData = select;
            });

        });
    }
 
    $(function () {
        $("input[ name='proCode']").val(getUrlVariable("proCode"));
        $("input[ name='bomCode']").val(getUrlVariable("bomCode"));
        loadData();
    })


  
    /**
    确认选择
    **/
    function Confirm() {
        if (cData.length < 1) {
            layer.msg("您没有选择任何数据"); return;
        } else {
            parent.GetBanGun(cData); //这是父页面函数
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        }
    }
</script>
